package com.ruoyi.web.controller.presure;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pressure.domain.KyLaneMgylAbnormal;
import com.ruoyi.pressure.service.IKyLaneMgylAbnormalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 错 杆（索）应力测点异常信息数据项说阴Controller
 * 
 * @author ruoyi
 * @date 2024-11-06
 */
@RestController
@RequestMapping("/pressure/mgylabnormal")
public class KyLaneMgylAbnormalController extends BaseController
{
    @Autowired
    private IKyLaneMgylAbnormalService kyLaneMgylAbnormalService;

    /**
     * 查询错 杆（索）应力测点异常信息数据项说阴列表
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:list')")
    @GetMapping("/list")
    public TableDataInfo list(KyLaneMgylAbnormal kyLaneMgylAbnormal)
    {
        startPage();
        List<KyLaneMgylAbnormal> list = kyLaneMgylAbnormalService.selectKyLaneMgylAbnormalList(kyLaneMgylAbnormal);
        return getDataTable(list);
    }

    /**
     * 导出错 杆（索）应力测点异常信息数据项说阴列表
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:export')")
    @Log(title = "错 杆（索）应力测点异常信息数据项说阴", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KyLaneMgylAbnormal kyLaneMgylAbnormal)
    {
        List<KyLaneMgylAbnormal> list = kyLaneMgylAbnormalService.selectKyLaneMgylAbnormalList(kyLaneMgylAbnormal);
        ExcelUtil<KyLaneMgylAbnormal> util = new ExcelUtil<KyLaneMgylAbnormal>(KyLaneMgylAbnormal.class);
        util.exportExcel(response, list, "错 杆（索）应力测点异常信息数据项说阴数据");
    }

    /**
     * 获取错 杆（索）应力测点异常信息数据项说阴详细信息
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:query')")
    @GetMapping(value = "/{kyLaneMgylAbnormalId}")
    public AjaxResult getInfo(@PathVariable("kyLaneMgylAbnormalId") String kyLaneMgylAbnormalId)
    {
        return success(kyLaneMgylAbnormalService.selectKyLaneMgylAbnormalByKyLaneMgylAbnormalId(kyLaneMgylAbnormalId));
    }

    /**
     * 新增错 杆（索）应力测点异常信息数据项说阴
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:add')")
    @Log(title = "错 杆（索）应力测点异常信息数据项说阴", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KyLaneMgylAbnormal kyLaneMgylAbnormal)
    {
        return toAjax(kyLaneMgylAbnormalService.insertKyLaneMgylAbnormal(kyLaneMgylAbnormal));
    }

    /**
     * 修改错 杆（索）应力测点异常信息数据项说阴
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:edit')")
    @Log(title = "错 杆（索）应力测点异常信息数据项说阴", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KyLaneMgylAbnormal kyLaneMgylAbnormal)
    {
        return toAjax(kyLaneMgylAbnormalService.updateKyLaneMgylAbnormal(kyLaneMgylAbnormal));
    }

    /**
     * 删除错 杆（索）应力测点异常信息数据项说阴
     */
    @PreAuthorize("@ss.hasPermi('pressure:mgylabnormal:remove')")
    @Log(title = "错 杆（索）应力测点异常信息数据项说阴", businessType = BusinessType.DELETE)
	@DeleteMapping("/{kyLaneMgylAbnormalIds}")
    public AjaxResult remove(@PathVariable String[] kyLaneMgylAbnormalIds)
    {
        return toAjax(kyLaneMgylAbnormalService.deleteKyLaneMgylAbnormalByKyLaneMgylAbnormalIds(kyLaneMgylAbnormalIds));
    }

    /**
     * 锚杆应力近7日报警
     */
    @GetMapping("/getMgylValueList")
    public List getMgylValueList() {
        List<String> list = kyLaneMgylAbnormalService.getMgylValueList();
        return list;
    }

}
